<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>背景线性渐变</title>
    <style>
        div:nth-child(1) {
            display: flex;
            margin: 0 auto;
            width: 80%;
            height: 200px;
            /* background-color: pink; */
            /* background: linear-gradient(left, red, blue); */
            /* 需要添加浏览器私有属性  -webkit */
            background: -webkit-linear-gradient(left, red, blue);

        }

        div:nth-child(2) {
            display: flex;
            margin: 20px auto;
            width: 80%;
            height: 200px;
            /* background-color: pink; */
            /* background: linear-gradient(left, red, blue); */
            background: -webkit-linear-gradient(top left, red, blue);

        }
    </style>
</head>

<body>
    <div></div>
    <div></div>
</body>

</html>